package com.itheima.springbootwebbtalis.mapper;

import com.github.pagehelper.Page;
import com.itheima.springbootwebbtalis.pojo.Emp;
import com.itheima.springbootwebbtalis.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    // 分页查询
    Page<Emp> selectByPage(EmpQueryParam param);
    // 添加员工
    void add2(Emp emp);


    void deleteBatch(List<Integer> ids);

    @Select("select * from emp where id = #{id};")
    Emp selectById(Integer id);

    void update(Emp emp);
    @Select("select count(*) from emp where dept_id = #{id};")
    Integer selectByDeptId(Integer id);
    @MapKey("name")
    List<Map> jobCount();
    @MapKey("name")
    List<Map> genderCount();
     @Select("select * from emp;")
    List<Emp> showAll();

     @Select("select * from emp where username = #{username};")
    Emp selectByUsername(String username);
}
